<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:hx="http://htmx.org/attributes" lang="zh">
<head>
  <script th:src="@{/common/htmx206/htmx206.js}"></script>
  <title></title>
</head>
<body>
<!-- 使用 HTMX 触发局部刷新 -->
<div id="item-list"
     hx-get="@{/items/fragment}"
     hx-trigger="load delay:500ms">
</div>

<!-- 表单提交使用 HTMX -->
<form th:action="@{/items}"
      hx-post
      hx-target="#item-list"
      hx-swap="beforeend">
  <input type="text" th:field="*{newItem.name}" />
  <button type="submit">添加</button>
</form>
</body>
</html>